#include "toolbar.h"
#include "ui_toolbar.h"

Toolbar::Toolbar(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Toolbar)
{
    ui->setupUi(this);

    setWindowFlags(Qt::Widget | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
}

Toolbar::~Toolbar()
{
    delete ui;
}

void Toolbar::on_btnClear_clicked()
{
    emit clearPad();
}

void Toolbar::on_btnAnnotate_clicked()
{
    emit annotatePad();

    if(ui->btnAnnotate->text() == QString(u8"白板")) {
        ui->btnAnnotate->setText(QString(u8"批注"));
        ui->btnTrans->setEnabled(false);
    }
    else {
        ui->btnAnnotate->setText(QString(u8"白板"));
        ui->btnTrans->setEnabled(true);
    }
}

void Toolbar::on_btnTrans_clicked()
{
    emit transPad();
}

void Toolbar::on_btnExit_clicked()
{
    emit exitPad();
}

void Toolbar::on_btnScale_clicked()
{
    emit scalePad();

    if(ui->btnScale->text() == QString(u8"放大")) {
        ui->btnScale->setText(QString(u8"缩小"));
    }
    else {
        ui->btnScale->setText(QString(u8"放大"));
    }
}

void Toolbar::on_btnColorAlpha_clicked()
{
    emit colorAlpha();
}

void Toolbar::on_btnLineColor_clicked()
{
    emit lineColor();
}

void Toolbar::on_btnLineSize_clicked()
{
    emit lineSize();
}
